<%@ page contentType="text/html;charset=ISO-8859-1" %>
<%@ page isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<html>
	<head>
		<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
	    <link type="text/css" rel="stylesheet" href="/webapp/stylesheet/common.css">
	    <title>DeepStack : Tournament</title>
	  	<script type="text/javascript" language="javascript" src="/webapp/javascript/common.js">
	  	</script>
	</head>
  	<body>
  		<form action="/private/tournament" method="post">
  	  		<c:set scope="page" var="rank" value="0" />
  	  		<p>
  	  			Tournament <c:out value="${tournament.id}"></c:out>
  	  		</p>
  	  		<input type="hidden" value="${tournament.id}" name="tournament-id" id="tournament-id"/>
	  		<table>
	  			<tr>
	  				<th>Rank</th>
	  				<th>Player</th>
	  			</tr>
	  			<c:forEach var="player" items="${challengers}">
	  				<c:set scope="page" var="rank" value="${rank + 1}" />
	  			<tr>
	  				<td>
	  					<c:out value="${rank}"></c:out>
	  				</td>
	  				<td>
		  				<select name="player${rank}" id="player${rank}" style="width: 150px">
		  					<option value="" ><c:out value="${rank}"></c:out></option>
		  				<c:forEach var="player" items="${challengers}">
		    				<option value="${player.name}" >${player.name}</option>
		    			</c:forEach>
		    			</select>
	  				</td>
	  			</tr>
	    		</c:forEach>
	  		</table>
	  		<c:remove var="rank" scope="page"/>	
	  		<input type="submit" value="Finish">
  		</form>
	</body>
</html>